/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package es.us.master.web;

import es.us.master.ejb.UsuarioFacadeLocal;
import es.us.master.entity.Usuario;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author master
 */
@ManagedBean
@RequestScoped
public class LoginManagedBean {
    @EJB
    private UsuarioFacadeLocal usuarioFacade;

    /**
     * Creates a new instance of LoginManagedBean
     */
    public LoginManagedBean() {
        
    }
    
    public String login(){
        Usuario res = usuarioFacade.findByUsuarioAndPassword(null, null);
        String s = "";
        if (res==null){
            //TRAtamiento de error
            s="ERROR";
        } else {
            //tratamiento de acierto, crear session
            s="OK";
        }
        return s;
    }
}
